package model

type Resp struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Result  interface{} `json:"result"`
}

func (r Resp) Ok(inter interface{}) *Resp {
	r.Code = 200
	r.Message = "success"
	r.Result = inter
	return &r
}

func (r Resp) Received(inter interface{}) *Resp {
	r.Code = 200
	r.Message = "received"
	r.Result = inter
	return &r
}

func (r Resp) Empty(inter interface{}) *Resp {
	r.Code = 201
	r.Message = "empty"
	r.Result = inter
	return &r
}

func (r Resp) Scrapyed(inter interface{}) *Resp {
	r.Code = 202
	r.Message = "success"
	r.Result = inter
	return &r
}

func (r Resp) Error(inter interface{}) *Resp {
	r.Code = 500
	r.Message = "failed"
	r.Result = inter
	return &r
}
